Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: 🍺 Support for YieldStmt statement #176

Merged
merged 3 commits into from
Nov 5, 2024
Merged

Conversation

shivasurya
Copy link
Owner

Description:

This pull request introduces support for parsing and handling yield statements in Java source code within the sourcecode-parser package. The changes include modifications to the core parsing logic, the addition of new test cases, and updates to the model and query handling to accommodate yield statements.

Parsing and Model Updates:

  • Added YieldStmt to the Node struct in sourcecode-parser/graph/construct.go and implemented parsing logic for yield statements. [1] [2]
  • Introduced ParseYieldStatement function in sourcecode-parser/graph/java/parse_statement.go to handle the parsing of yield statements.
  • Added YieldStmt struct and its methods in sourcecode-parser/model/stmt.go to represent yield statements in the model.

Testing Enhancements:

  • Updated TestBuildGraphFromAST in sourcecode-parser/graph/construct_test.go to include test cases for yield statements and adjusted expected node and edge counts. [1] [2]
  • Added TestParseYieldStatement in sourcecode-parser/graph/java/parse_statement_test.go to verify the correct parsing of various yield statement scenarios.
  • Created TestYieldStmt in sourcecode-parser/model/stmt_test.go to test the ToString method of the YieldStmt struct.

Query Handling:

  • Added GetYieldStmt method in sourcecode-parser/graph/query.go and updated generateProxyEnv to handle yield statements in queries. [1] [2] [3] [4]

Example Usage:

  • Included a switch statement with yield in test-src/android/app/src/main/java/com/ivb/udacity/movieDetailActivity.java to demonstrate the new functionality.

Checklist:

  • Tests passing (gradle testGo)?
  • Lint passing (golangci-lint run this requires golangci-lint)?

@shivasurya shivasurya added the enhancement New feature or request label Nov 5, 2024
@shivasurya shivasurya self-assigned this Nov 5, 2024
@shivasurya shivasurya changed the title feature 🍺 Support for YieldStmt statement feature: 🍺 Support for YieldStmt statement Nov 5, 2024
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 85.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 73.85%. Comparing base (67efb23) to head (da72e0a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sourcecode-parser/graph/query.go 55.55% 4 Missing ⚠️
sourcecode-parser/model/stmt.go 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #176      +/-   ##
==========================================
+ Coverage   73.52%   73.85%   +0.32%     
==========================================
  Files          16       16              
  Lines        2274     2314      +40     
==========================================
+ Hits         1672     1709      +37     
- Misses        561      565       +4     
+ Partials       41       40       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shivasurya shivasurya merged commit 776da67 into main Nov 5, 2024
4 checks passed
@shivasurya shivasurya deleted the shiva/yield-stmt branch November 5, 2024 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant